package autoorder.zsxmlv.service;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import java.io.IOException;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Author: ZSXM
 * @Description:
 * @Company: DingZheng
 * @Date: Create by 2018/6/12 23:45
 * @Version: 1.0
 * @Modify by:
 */
public class JobDataSelenuim {

    public static void main(String[] args) throws InterruptedException, IOException {


//        ChromeDriver chromeDriver = new ChromeDriver();
//
////        for (int i = 1; i <= 10; i++) {
//            chromeDriver.get("http://job.cqyc.net/jobs/jobs_list/page/" + 1 + ".html");
//            Thread.sleep(1500);
//        List<WebElement> elementsByClassName = chromeDriver.findElementsByClassName("td-j-name");
//        for (WebElement webElement : elementsByClassName) {
//            System.out.println(webElement.getText());
//            System.out.println(webElement.getTagName());
//        }
//
//        chromeDriver.quit();
//        Document document = Jsoup.connect("http://job.cqyc.net/jobs/jobs_list/page/1.html").userAgent("Mozilla").get();
//
//        Pattern compile = Pattern.compile("[href=/jobs/\\d*.html]");
//        Matcher matcher = compile.matcher(document.toString());
//        while (matcher.find()) {
//            System.out.println(matcher.group());
//            System.out.println(matcher.group(0));
//        }

//        Elements a = document.getElementsByTag("a");
//        for (Element e : a) {
//            Elements elementsContainingOwnText = e.getElementsContainingOwnText("href=job");
//            for (Element element : elementsContainingOwnText) {
//                System.out.println(element.text());
//            }
//        }

        Document document = Jsoup.connect("http://edu.cqeec.cn/").get();
        System.out.println(document.toString());

    }
}
